/**
*
* 2007-11-3 下午01:21:02
* @author xuhuan
*/

package edu.ccut.saturn.studio.logic.parts.policy;

import org.eclipse.gef.commands.Command;
import org.eclipse.gef.editpolicies.GraphicalNodeEditPolicy;
import org.eclipse.gef.requests.CreateConnectionRequest;
import org.eclipse.gef.requests.ReconnectRequest;

import edu.ccut.saturn.studio.logic.model.commands.SaturnFalseConnectionCommand;
import edu.ccut.saturn.studio.logic.model.saturn.SaturnDecisionNode;

public class SaturnGraphicalNodeEditPolicy extends GraphicalNodeEditPolicy {

	@Override
	protected Command getConnectionCompleteCommand(
			CreateConnectionRequest request) {
		

		SaturnFalseConnectionCommand cmd=(SaturnFalseConnectionCommand)request
		.getStartCommand();
		cmd.setTarget((SaturnDecisionNode) getHost().getModel());
		return cmd;
	

	}

	@Override
	protected Command getConnectionCreateCommand(CreateConnectionRequest request) {

		SaturnDecisionNode source = (SaturnDecisionNode) getHost().getModel();
		int style = ((Integer) request.getNewObjectType())
				.intValue();
		SaturnFalseConnectionCommand cmd =new SaturnFalseConnectionCommand(source,style);
		request.setStartCommand(cmd);
		return cmd;
	
	}

	@Override
	protected Command getReconnectSourceCommand(ReconnectRequest request) {
		return null;

	}

	@Override
	protected Command getReconnectTargetCommand(ReconnectRequest request) {
		return null;

	}

}
